<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * SfAudit filter form base class.
 *
 * @package    tercermilenio
 * @subpackage filter
 * @author     Your name here
 */
class BaseSfAuditFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'remote_ip_address' => new sfWidgetFormFilterInput(),
      'object'            => new sfWidgetFormFilterInput(),
      'object_key'        => new sfWidgetFormFilterInput(),
      'object_changes'    => new sfWidgetFormFilterInput(),
      'query'             => new sfWidgetFormFilterInput(),
      'user'              => new sfWidgetFormFilterInput(),
      'type'              => new sfWidgetFormFilterInput(),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'remote_ip_address' => new sfValidatorPass(array('required' => false)),
      'object'            => new sfValidatorPass(array('required' => false)),
      'object_key'        => new sfValidatorPass(array('required' => false)),
      'object_changes'    => new sfValidatorPass(array('required' => false)),
      'query'             => new sfValidatorPass(array('required' => false)),
      'user'              => new sfValidatorPass(array('required' => false)),
      'type'              => new sfValidatorPass(array('required' => false)),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('sf_audit_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'SfAudit';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'remote_ip_address' => 'Text',
      'object'            => 'Text',
      'object_key'        => 'Text',
      'object_changes'    => 'Text',
      'query'             => 'Text',
      'user'              => 'Text',
      'type'              => 'Text',
      'created_at'        => 'Date',
    );
  }
}
